package com.edgarli.web.controller.gamble;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.edgarli.common.annotation.Log;
import com.edgarli.common.core.controller.BaseController;
import com.edgarli.common.core.domain.AjaxResult;
import com.edgarli.common.enums.BusinessType;
import com.edgarli.gamble.domain.TLottoNz;
import com.edgarli.gamble.service.ITLottoNzService;
import com.edgarli.common.utils.poi.ExcelUtil;
import com.edgarli.common.core.page.TableDataInfo;

/**
 * 大乐透_内置Controller
 * 
 * @author ruoyi
 * @date 2024-09-08
 */
@RestController
@RequestMapping("/gamble/lottonz")
public class TLottoNzController extends BaseController
{
    @Autowired
    private ITLottoNzService tLottoNzService;

    /**
     * 查询大乐透_内置列表
     */
    @PreAuthorize("@ss.hasPermi('gamble:gamble:list')")
    @GetMapping("/list")
    public TableDataInfo list(TLottoNz tLottoNz)
    {
        startPage();
        List<TLottoNz> list = tLottoNzService.selectTLottoNzList(tLottoNz);
        return getDataTable(list);
    }

    /**
     * 导出大乐透_内置列表
     */
    @PreAuthorize("@ss.hasPermi('gamble:gamble:export')")
    @Log(title = "大乐透_内置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TLottoNz tLottoNz)
    {
        List<TLottoNz> list = tLottoNzService.selectTLottoNzList(tLottoNz);
        ExcelUtil<TLottoNz> util = new ExcelUtil<TLottoNz>(TLottoNz.class);
        util.exportExcel(response, list, "大乐透_内置数据");
    }

    /**
     * 获取大乐透_内置详细信息
     */
    @PreAuthorize("@ss.hasPermi('gamble:gamble:query')")
    @GetMapping(value = "/{lottoNzId}")
    public AjaxResult getInfo(@PathVariable("lottoNzId") Long lottoNzId)
    {
        return AjaxResult.success(tLottoNzService.selectTLottoNzByLottoNzId(lottoNzId));
    }

    /**
     * 新增大乐透_内置
     */
    @PreAuthorize("@ss.hasPermi('gamble:gamble:add')")
    @Log(title = "大乐透_内置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TLottoNz tLottoNz)
    {
        return toAjax(tLottoNzService.saveOrUpdate(tLottoNz));
    }

    /**
     * 修改大乐透_内置
     */
    @PreAuthorize("@ss.hasPermi('gamble:gamble:edit')")
    @Log(title = "大乐透_内置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TLottoNz tLottoNz)
    {
        return toAjax(tLottoNzService.saveOrUpdate(tLottoNz));
    }

    /**
     * 删除大乐透_内置
     */
    @PreAuthorize("@ss.hasPermi('gamble:gamble:remove')")
    @Log(title = "大乐透_内置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{lottoNzIds}")
    public AjaxResult remove(@PathVariable Long[] lottoNzIds)
    {
        return toAjax(tLottoNzService.deleteTLottoNzByLottoNzIds(lottoNzIds));
    }
}
